<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-proMem-edit" th:object="${proMem}">
            <input id="memId" name="memId" th:field="*{memId}"  type="hidden">
            <div class="form-group">	
				<label class="col-sm-3 control-label">项目名称：</label>
				<div class="col-sm-8">
					<select id="proId" name="proId" class="form-control m-b" th:with="type=${@ProInfoServiceImpl.selectProsBySta('0')}">
						<option th:each="dict : ${type}" th:text="${dict.proName}" th:value="${dict.proId}" th:field="*{proId}"></option>
					</select>
				</div>
			</div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">人员级别：</label>
                <div class="col-sm-8">
                    <select id="wlLevel" class="form-control m-b" th:with="type=${@dict.getType('pm_emp_level')}">
                    	<option value="">请选择...</option>
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"  th:field="*{wlLevel}"></option>
	                </select>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">证件号码：</label>
                <div class="col-sm-8">
                    <input id="empId" name="empId" th:field="*{empId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <input id="empNm" name="empNm" th:field="*{empNm}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">是否在人员名单内：</label>
                <div class="col-sm-8">
					<select id="memIsNl" class="form-control m-b" th:with="type=${@dict.getType('pm_yes_no')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{memIsNl}"></option>
	                </select>
				</div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
					<select id="memStat" class="form-control m-b" th:with="type=${@dict.getType('pm_emp_status')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{memStat}"></option>
	                </select>
				</div>
            </div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "pm/proMem";
		$("#form-proMem-edit").validate({
			rules:{
				proId:{
					required:true,
				},
				empId:{
					required:true,
				},
				empNm:{
					required:true,
				}
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            edit();
	        }
	    }
		
		function edit() {
        	var memId = $("input[name='memId']").val();
        	var proId = $("#proId option:selected").val();
        	var wlLevel = $("#wlLevel option:selected").val();
        	var empId = $("input[name='empId']").val();
        	var empNm = $("input[name='empNm']").val();
        	var memIsNl = $("#memIsNl option:selected").val();
        	var memStat = $("#memStat option:selected").val();
        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "pm/proMem/edit",
        		data : {
        			"memId": memId,
        			"proId": proId,
        			"wlLevel": wlLevel,
        			"empId": empId,
        			"empNm": empNm,
        			"memIsNl": memIsNl,
        			"memStat": memStat
        		},
        		async : true,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }
	</script>
</body>
</html>
